package com.oo.polymorphic_4.animal;

import java.util.Scanner;

/**
 * AnimalTest--${description}
 *
 * @author: Jovi
 * @createTime: 2017-05-09 16:43
 **/
public class AnimalTest {

    public static void main(String[] args) {
        Cat one = new Cat("埃及猫", "黄色", 2, "开罗");
        Rabbit two = new Rabbit("兔子", "灰色", 1, "小兔子");
        Dog three = new Dog("狗子", "黑色", 3);

        System.out.println("请选择要饲养的动物：（1.猫，2.兔子，3.狗）");
        Scanner sc = new Scanner(System.in);
        int id = sc.nextInt();
        Animal cmp = null;
        switch (id) {
            case 1:
                cmp = one;
                break;
            case 2:
                cmp = two;
                break;
            case 3:
                cmp = three;
                break;
        }
        if (cmp != null) {
            cmp.breed();
        }
    }
}
